package cn.cjxy.day14springboot_mybatis01.mapper;

import cn.cjxy.day14springboot_mybatis01.domain.Student;
import cn.cjxy.day14springboot_mybatis01.query.StudentQuery;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 持久层
 * @author huangjie
 * @date 2025/10/19
 */
@Mapper//表示这是mapper层
public interface StudentMapper {
    //查询所有学生信息的同时查出班级信息
    //@Select("select * from t_student")   不推荐 low  low
    List<Student> findAll();
    //根据id查询
    Student findById(Long id);
    //添加
    int insert(Student student);
    //修改
    void update(Student student);
    //删除
    void deleteById(Long id);

    //根据姓名模糊查询
     List<Student> findByNameLike(String name);

     //动态表名查询
     List<Student> findByTableName(String tableName);
     //if标签   根据姓名和年龄查询
     List<Student> findByNameAndAge(StudentQuery studentQuery);
     //分页查询带参数
     List<Student> findByPage(StudentQuery studentQuery);

     //批量删除
     void deleteBatch(Long[] ids);
     //批量新增
     void insertBatch(List<Student> students);
}
